package org.lc.service.system.util;


import org.lc.service.system.entity.SysPermission;

import java.util.ArrayList;
import java.util.List;

public class ConstantUtil {

    private static SysPermission getPermission(String name, String code, String remark, String menuId) {
        SysPermission permission = new SysPermission();
        permission.setCode(code);
        permission.setName(name);
        permission.setRemark(remark);
        permission.setMenuId(menuId);
        return permission;
    }

    public static List<SysPermission> getCrudPermission(String menuId, String moda) {
        List<SysPermission> permissions = new ArrayList<>();
        if(moda.equals("ROUTER")) {
            permissions.add(getPermission("新增", "post", "控制添加新增", menuId));
            permissions.add(getPermission("删除", "delete", "控制删除", menuId));
            permissions.add(getPermission("修改", "patch", "控制修改", menuId));
        }
        permissions.add(getPermission("查看", "get", "控制菜单访问", menuId));
        return permissions;
    }
}
